package o;

import android.content.Context;
import com.huawei.hms.support.api.entity.pay.HwPayConstant;
import java.io.File;
import java.util.LinkedHashMap;
import java.util.Map;
import o.bjy.c;
import org.json.JSONObject;

public class dse {
    public static boolean ˏ(Context context) {
        boolean ˏ = new drz().ˏ(ˎ(context), new dsf() {
            public Map<String, String> ॱ(String str) {
                Map<String, String> linkedHashMap = new LinkedHashMap();
                Logger.ˏ("LogReport", "start genParams...");
                String valueOf = String.valueOf(System.currentTimeMillis());
                String str2 = "";
                try {
                    str2 = bkq.ˊ(bkn.ॱ(bjx.ˏ()), true);
                } catch (SecurityException e) {
                    Logger.e("LogReport", "logreport SecurityException");
                }
                c ॱ = new bjy(ContentManager.getInstant().getContext()).ॱ();
                ˎ(linkedHashMap, "deviceId", ॱ.ˎ);
                ˎ(linkedHashMap, "deviceIdType", String.valueOf(ॱ.ॱ));
                ˎ(linkedHashMap, "logId", str2);
                ˎ(linkedHashMap, "logfileName", str);
                ˎ(linkedHashMap, "method", dfm.APIMETHOD);
                ˎ(linkedHashMap, HwPayConstant.KEY_SIGN, HcridSession.ˋ().ˊ());
                ˎ(linkedHashMap, "ts", valueOf);
                return linkedHashMap;
            }

            public boolean ˏ(String str) {
                try {
                    Logger.ˏ("LogReport", "start parseResult...");
                    int i = new JSONObject(str).getInt("rtnCode");
                    if (i == 0) {
                        return true;
                    }
                    Logger.ˋ("LogReport", "LogReport error, retCode:" + i);
                    return false;
                } catch (Exception e) {
                    Logger.ˋ("LogReport", "LogReport Exception " + e.toString());
                    return false;
                }
            }

            public String ˊ() {
                return cvx.ˎ("server.store") + "clientApi";
            }
        });
        if (ˏ) {
            ˊ(context);
        }
        return ˏ;
    }

    private static void ˊ(Context context) {
        File file = new File(epp.ˏ(context));
        if (file.exists() && !file.delete()) {
            Logger.ˋ("LogReport", "zipFile delete error.");
        }
    }

    /* JADX WARNING: inconsistent code. */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public static java.io.File ˎ(android.content.Context r8) {
        /*
        r1 = 0;
        r0 = o.epp.ˊ(r8);	 Catch:{ FileNotFoundException -> 0x0046, IOException -> 0x005b, all -> 0x0073 }
        r2 = o.dof.ˋ(r0);	 Catch:{ FileNotFoundException -> 0x0046, IOException -> 0x005b, all -> 0x0073 }
        if (r2 == 0) goto L_0x0016;
    L_0x000b:
        o.dnw.ˎ(r1);
        o.dnw.ˎ(r1);
        o.dnw.ˎ(r1);
        r0 = r1;
    L_0x0015:
        return r0;
    L_0x0016:
        r5 = new java.io.File;	 Catch:{ FileNotFoundException -> 0x0046, IOException -> 0x005b, all -> 0x0073 }
        r5.<init>(r0);	 Catch:{ FileNotFoundException -> 0x0046, IOException -> 0x005b, all -> 0x0073 }
        r0 = new java.io.File;	 Catch:{ FileNotFoundException -> 0x0046, IOException -> 0x005b, all -> 0x0073 }
        r2 = o.epp.ˏ(r8);	 Catch:{ FileNotFoundException -> 0x0046, IOException -> 0x005b, all -> 0x0073 }
        r0.<init>(r2);	 Catch:{ FileNotFoundException -> 0x0046, IOException -> 0x005b, all -> 0x0073 }
        r4 = new java.io.FileOutputStream;	 Catch:{ FileNotFoundException -> 0x00a0, IOException -> 0x008c, all -> 0x0073 }
        r4.<init>(r0);	 Catch:{ FileNotFoundException -> 0x00a0, IOException -> 0x008c, all -> 0x0073 }
        r3 = new java.io.BufferedOutputStream;	 Catch:{ FileNotFoundException -> 0x00a4, IOException -> 0x0093, all -> 0x0080 }
        r2 = 1048576; // 0x100000 float:1.469368E-39 double:5.180654E-318;
        r3.<init>(r4, r2);	 Catch:{ FileNotFoundException -> 0x00a4, IOException -> 0x0093, all -> 0x0080 }
        r2 = new java.util.zip.ZipOutputStream;	 Catch:{ FileNotFoundException -> 0x00a8, IOException -> 0x0099, all -> 0x0083 }
        r2.<init>(r3);	 Catch:{ FileNotFoundException -> 0x00a8, IOException -> 0x0099, all -> 0x0083 }
        r1 = r0.getName();	 Catch:{ FileNotFoundException -> 0x00ac, IOException -> 0x009e }
        o.dsc.ˋ(r5, r2, r1);	 Catch:{ FileNotFoundException -> 0x00ac, IOException -> 0x009e }
        o.dnw.ˎ(r2);
        o.dnw.ˎ(r3);
        o.dnw.ˎ(r4);
        goto L_0x0015;
    L_0x0046:
        r0 = move-exception;
        r2 = r1;
        r3 = r1;
        r0 = r1;
    L_0x004a:
        r4 = "LogReport";
        r5 = "getZipFile, FileNotFoundException ";
        o.dna.ˊ(r4, r5);	 Catch:{ all -> 0x0088 }
        o.dnw.ˎ(r1);
        o.dnw.ˎ(r2);
        o.dnw.ˎ(r3);
        goto L_0x0015;
    L_0x005b:
        r0 = move-exception;
        r2 = r1;
        r3 = r1;
        r4 = r1;
        r7 = r0;
        r0 = r1;
        r1 = r7;
    L_0x0062:
        r5 = "LogReport";
        r6 = "getZipFile, IOException ";
        o.dna.ˋ(r5, r6, r1);	 Catch:{ all -> 0x0085 }
        o.dnw.ˎ(r2);
        o.dnw.ˎ(r3);
        o.dnw.ˎ(r4);
        goto L_0x0015;
    L_0x0073:
        r0 = move-exception;
        r3 = r1;
        r4 = r1;
    L_0x0076:
        o.dnw.ˎ(r1);
        o.dnw.ˎ(r3);
        o.dnw.ˎ(r4);
        throw r0;
    L_0x0080:
        r0 = move-exception;
        r3 = r1;
        goto L_0x0076;
    L_0x0083:
        r0 = move-exception;
        goto L_0x0076;
    L_0x0085:
        r0 = move-exception;
        r1 = r2;
        goto L_0x0076;
    L_0x0088:
        r0 = move-exception;
        r4 = r3;
        r3 = r2;
        goto L_0x0076;
    L_0x008c:
        r2 = move-exception;
        r3 = r1;
        r4 = r1;
        r7 = r2;
        r2 = r1;
        r1 = r7;
        goto L_0x0062;
    L_0x0093:
        r2 = move-exception;
        r3 = r1;
        r7 = r1;
        r1 = r2;
        r2 = r7;
        goto L_0x0062;
    L_0x0099:
        r2 = move-exception;
        r7 = r2;
        r2 = r1;
        r1 = r7;
        goto L_0x0062;
    L_0x009e:
        r1 = move-exception;
        goto L_0x0062;
    L_0x00a0:
        r2 = move-exception;
        r2 = r1;
        r3 = r1;
        goto L_0x004a;
    L_0x00a4:
        r2 = move-exception;
        r2 = r1;
        r3 = r4;
        goto L_0x004a;
    L_0x00a8:
        r2 = move-exception;
        r2 = r3;
        r3 = r4;
        goto L_0x004a;
    L_0x00ac:
        r1 = move-exception;
        r1 = r2;
        r2 = r3;
        r3 = r4;
        goto L_0x004a;
        */
        throw new UnsupportedOperationException("Method not decompiled: o.dse.ˎ(android.content.Context):java.io.File");
    }
}
